﻿@using HopNguyenModel
@model HopNguyenModel.Admin
@{
    ViewBag.Title = "Thêm trang quản trị";
    Layout = "~/Views/Shared/_BackendLayout.cshtml";
    List<HopNguyenModel.Page> lstPage = ViewBag.lstPage;
}
<div class="page-header position-relative">
    <h1>Thêm trang cho tài khoản: @Model.Username
    </h1>
</div>
<div class="row-fluid">
    <form action="/cpanel/AddPage" method="POST">
        <input type="hidden" name="AdminId" value="@Model.Id"/>
        <input type="hidden" name="aid" value="@Model.Id"/>
        <div class="formField">
            <div class="row-fluid">
                <div class="span2">
                    <span class="fLabel">Loại trang</span>
                </div>
                <div class="span9">
                    @Html.DropDownList("GroupId", null, new { @onchange = "grouppagechange(this.value);" })
                </div>
            </div>
        </div>
        <div class="formField">
            <div class="row-fluid">
                <div class="span2">
                    <span class="fLabel">Tên trang</span>
                </div>
                <div class="span9">
                    @Html.DropDownList("PageId", null, new { @required = "required" })
                </div>
            </div>
        </div>
        <div class="formField">
            <div class="row-fluid">
                <div class="span2">
                    <span class="fLabel">Nhóm trang</span>
                </div>
                <div class="span9">
                    @Html.DropDownList("TypeId", null, new { @required = "required" })
                </div>
            </div>
        </div>
        <div class="formField">
            <div class="row-fluid">
                <div class="span2">
                    <span class="fLabel">Tên trang mới</span>
                </div>
                <div class="span9">
                    <input type="text" name="name">
                </div>
            </div>
        </div>
        <div class="formField">
            <div class="row-fluid">
                <div class="span2">
                    <span class="fLabel">Tham số</span>
                </div>
                <div class="span9">
                    <input type="text" name="Parameter" placeholder="vd: ?id=10&type=10">
                </div>
            </div>
        </div>
        <div class="formButtons">
            <div class="row-fluid">
                <div class="span2"></div>
                <div class="span9">
                    <button class="btn btn-info" type="submit">
                        <i class="icon-ok bigger-110"></i>
                        Tạo mới
                    </button>
                </div>
            </div>
        </div>
    </form>

    <br />
    <br />
    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th>Mã</th>
                <th>Tên trang</th>
                <th>Nhóm</th>
                <th>Tham số</th>
                <th>Thao tác</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in lstPage)
            {
                <tr>
                    <td>@item.Id</td>
                    <td>@item.Name</td>
                    <td>@item.TypePage.Name</td>
                    <td>@item.Parameter</td>
                    <td>
                        <a href="/Cpanel/DeletePage/@item.Id" onclick="javascript:return confirm('Are you sure?');" title="Xóa">Xóa</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

